<script>
import outMain from "@/components/outMain.vue";
import elSelect from "@/components/public/elSelect.vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { ContractDetails } from "@/http/api";
export default {
  components: { outMain, elSelect },
  name: "",
  data() {
    return {
      detailId: this.$route.query.id,
      formData: {},
    };
  },
  props: {},
  setup() {},
  methods: {
    backFn() {
      this.$router.back();
    },
    getData() {
      ContractDetails({ contract_id: this.detailId }).then((res) => {
        if (res.data.code == 1) {
          this.formData = res.data.data;
        }
      });
    },
    checkItemValue(type, value, sign_value) {
      let result =
        this.formData.type == type
          ? this.formData[value]
          : this.formData[sign_value];
      return result;
    },
  },
  mounted() {},
  created() {
    this.getData();
  },
};
</script>
<template>
  <outMain>
    <div class="formCont">
      <div class="formStep">
        <div class="formHead">
          <div>合同详情(已完成)</div>
          <btn value="返回上一级" @ok="backFn()"></btn>
        </div>
        <div class="formMain">
          <div class="stepCont">
            <div class="formDes">
              <div class="desTitle">订单信息</div>
              <div class="desCont">
                <div class="desItem desNoLeft">
                  <div class="desName">合同编号</div>
                  <div class="desText">{{ formData.contract_number }}</div>
                </div>
                <div class="desItem">
                  <div class="desName">合同状态</div>
                  <div class="desText">
                    <el-tag
                      type="info"
                      v-if="formData.contract_signing_status == 3"
                      >已取消</el-tag
                    >
                    <el-tag
                      type="success"
                      v-if="formData.contract_signing_status == 2"
                      >已完成</el-tag
                    >
                    <el-tag v-if="formData.contract_signing_status == 1"
                      >待签约</el-tag
                    >
                  </div>
                </div>
                <div class="desItem">
                  <div class="desName">借款金额</div>
                  <div class="desText">{{ formData.loan_money }}元</div>
                </div>
                <div class="desItem desNoLeft">
                  <div class="desName">还款金额</div>
                  <div class="desText">{{ formData.repayment_money }}元</div>
                </div>
                <div class="desItem">
                  <div class="desName">年化利率</div>
                  <div class="desText">{{ formData.interest_rate }}%</div>
                </div>
                <div class="desItem">
                  <div class="desName">借款日期</div>
                  <div class="desText">
                    {{ formData.loan_date }}
                  </div>
                </div>
                <div class="desItem desNoLeft">
                  <div class="desName">还款日期</div>
                  <div class="desText">
                    {{ formData.repayment_date }}
                  </div>
                </div>
                <div class="desItem">
                  <div class="desName">借款用途</div>
                  <div class="desText">
                    {{ formData.loan_use }}
                  </div>
                </div>
                <div class="desItem">
                  <div class="desName">其他说明</div>
                  <div class="desText">
                    {{ formData.other_content }}
                  </div>
                </div>
                <div class="desItem desNoLeft">
                  <div class="desName">手续费</div>
                  <div class="desText">{{ formData.commission_money }}元</div>
                </div>
                <div class="desItem">
                  <div class="desName">支付方式</div>
                  <div class="desText">微信支付</div>
                </div>
                <div class="desItem">
                  <div class="desName">支付时间</div>
                  <div class="desText">
                    {{ formData.pay_time }}
                  </div>
                </div>
              </div>
            </div>
            <div class="formDes">
              <div class="desTitle">借款人信息</div>
              <div class="desCont">
                <div class="desItem desNoLeft">
                  <div class="desName">借款人</div>
                  <div class="desText">
                    {{
                      checkItemValue(1, "name", "signing_name")
                        ? checkItemValue(1, "name", "signing_name")
                        : "- -"
                    }}
                  </div>
                </div>
                <div class="desItem">
                  <div class="desName">借款人电话</div>
                  <div class="desText">
                    {{
                      checkItemValue(1, "mobile", "signing_mobile")
                        ? checkItemValue(1, "mobile", "signing_mobile")
                        : "- -"
                    }}
                  </div>
                </div>
                <div class="desItem">
                  <div class="desName">身份证号</div>
                  <div class="desText">
                    {{
                      checkItemValue(1, "idcard", "signing_idcard")
                        ? checkItemValue(1, "idcard", "signing_idcard")
                        : "- -"
                    }}
                  </div>
                </div>
              </div>
            </div>
            <div class="formDes">
              <div class="desTitle">借出人信息</div>
              <div class="desCont">
                <div class="desItem desNoLeft">
                  <div class="desName">借出人</div>
                  <div class="desText">
                    {{
                      checkItemValue(2, "name", "signing_name")
                        ? checkItemValue(2, "name", "signing_name")
                        : "- -"
                    }}
                  </div>
                </div>
                <div class="desItem">
                  <div class="desName">借出人电话</div>
                  <div class="desText">
                    {{
                      checkItemValue(2, "mobile", "signing_mobile")
                        ? checkItemValue(2, "mobile", "signing_mobile")
                        : "- -"
                    }}
                  </div>
                </div>
                <div class="desItem">
                  <div class="desName">身份证号</div>
                  <div class="desText">
                    {{
                      checkItemValue(2, "idcard", "signing_idcard")
                        ? checkItemValue(2, "idcard", "signing_idcard")
                        : "- -"
                    }}
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </outMain>
</template>
<style scoped lang="less"></style>
